package site.lizhivscaomei.aliyun.oss.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * OSS上传文件配置类
 */
@Component
@ConfigurationProperties(prefix = "oss.aliyun")
public class OSSConfigProperties {
    private String accessId;
    private String accessKey;
    private String host;
    private String bucket;
    /**
     * 访问域名
     */
    private String endpoint = "oss-cn-beijing.aliyuncs.com";
    /**
     * 文件夹
     */
    private String dir="";
    /**
     * 回调地址
     */
    private String callbackUrl;
    /**
     * 超时时间,默认5分钟，单位（秒）
     */
    private int expire = 300;
    /*地域*/
    private String region;
    /**
     * STS API 版本
     */
    private String stsApiVersion;
    /**
     * STS roleArn
     */
    private String roleArn = "";
    /**
     * STS roleSessionName
     * 用来标识临时凭证的名称，建议使用不同的应用程序用户来区分。
     */
    private String roleSessionName = "session-name";
    /**
     * STS Policy
     * 默认拥有最高权限
     */
    private String stsPolicy = "{\n" +
            "  \"Statement\": [\n" +
            "    {\n" +
            "      \"Action\": [\n" +
            "        \"oss:*\"\n" +
            "      ],\n" +
            "      \"Effect\": \"Allow\",\n" +
            "      \"Resource\": [\"acs:oss:*:*:*\"]\n" +
            "    }\n" +
            "  ],\n" +
            "  \"Version\": \"1\"\n" +
            "}";
    /**
     * STS durationSeconds 单位：秒
     * 默认最长时间（900~3600）
     */
    private long stsDurationSeconds = 3600;

    public String getAccessId() {
        return accessId;
    }

    public void setAccessId(String accessId) {
        this.accessId = accessId;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        this.bucket = bucket;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getDir() {
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }

    public String getCallbackUrl() {
        return callbackUrl;
    }

    public void setCallbackUrl(String callbackUrl) {
        this.callbackUrl = callbackUrl;
    }

    public int getExpire() {
        return expire;
    }

    public void setExpire(int expire) {
        this.expire = expire;
    }

    public String getStsApiVersion() {
        return stsApiVersion;
    }

    public void setStsApiVersion(String stsApiVersion) {
        this.stsApiVersion = stsApiVersion;
    }

    public String getRoleArn() {
        return roleArn;
    }

    public void setRoleArn(String roleArn) {
        this.roleArn = roleArn;
    }

    public String getRoleSessionName() {
        return roleSessionName;
    }

    public void setRoleSessionName(String roleSessionName) {
        this.roleSessionName = roleSessionName;
    }

    public String getStsPolicy() {
        return stsPolicy;
    }

    public void setStsPolicy(String stsPolicy) {
        this.stsPolicy = stsPolicy;
    }

    public long getStsDurationSeconds() {
        return stsDurationSeconds;
    }

    public void setStsDurationSeconds(long stsDurationSeconds) {
        this.stsDurationSeconds = stsDurationSeconds;
    }
}
